﻿package jokers.JAdv {
	import jokers.*;
	import jokers.JAdv.*;
	
	public class JChapter12 extends JChapter {
		//初始化章节
		public override function initChapter():void{
			JPara.timer_total = 181;
			JPara.crystalNum = 7;
					
			JTool.initToolBar();
			JTool.setToolEnable(JTool.TOOL_SEARCH);
			JTool.setToolEnable(JTool.TOOL_BOMB);
			
			temp_num_crystal = new Array();
			for(var i:int = 0 ; i < 8 ; i++){
				temp_num_crystal[i] = 0;
				comic_number[i]=0;
			}
		}
		
		//特殊关卡会要求刷新特殊数据
		public override function run():void{
			for(var i:int = 0 ; i < 7 ; i++){
				if(JPara.num_crystal[i] >temp_num_crystal[i]){
					  if(comic_number[i]<2)
					  comic_number[i]++;
					   for(var j:int = 0 ; j < 7 ; j++)
					       if(j!=i&&comic_number[j]<2)
						     comic_number[j]=0;
				}
				temp_num_crystal[i]=JPara.num_crystal[i] ;
			}
		}
		
		//是否胜利
		public override function isWin():Boolean{      
			  for(var i:int = 0 ; i < 7 ; i++){
			      if( comic_number[i]<2)
				  return false;
			  }
			  return true;
		}
		
		//文字版提醒
		public override function showTips():String{
			var ret:String = "";
			ret = "连续消除黄色：" + comic_number[JCrystal.CRYSTAL_C_YELLO] + "/2\n";
			ret += "连续消除白色：" + comic_number[JCrystal.CRYSTAL_C_WHITE] + "/2\n";
			ret += "连续消除蓝色：" + comic_number[JCrystal.CRYSTAL_C_BLUE] + "/2\n";
			ret += "连续消除红色：" + comic_number[JCrystal.CRYSTAL_C_RED] + "/2\n";
			ret += "连续消除粉色：" + comic_number[JCrystal.CRYSTAL_C_PINK] + "/2\n";
			ret += "连续消除橙色：" + comic_number[JCrystal.CRYSTAL_C_ORANGE] + "/2\n";
			ret += "连续消除绿色：" + comic_number[JCrystal.CRYSTAL_C_GREEN] + "/2";

			return ret;
		}
		
		var temp_num_crystal=new Array();
		var comic_number=new Array();
	}
}
